<template>
  <div class="app-container">
    <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
      <el-tab-pane label="我的审核" name="Audit" v-if="userStore.roles[0] != 'student'">
        <Audit
          v-if="activeName == 'Audit'"
        ></Audit>
      </el-tab-pane>
      <el-tab-pane label="我的提交" name="Application">
        <Application
          v-if="activeName == 'Application'"
        ></Application>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script setup name="PmsAuditList">
import { ref } from "vue";
import Audit from "./myAudit.vue";
import Application from "./myApplication.vue";
import useUserStore from "@/store/modules/user";
const userStore = useUserStore();
const route = useRoute();
const router = useRouter();

const activeName = ref("Audit");
const projectId = ref("");
const auditId = ref("");
function handleClick() {}
onMounted(() => {
  userStore.roles[0] == 'student'?activeName.value = "Application":''
});
watch(
  () => route,
  (newRoute, oldRoute) => {
    if (newRoute.query.id) {
      projectId.value = route.query.id;
    }
    if (newRoute.query.aid) {
      auditId.value = route.query.aid;
    }
  },
  { deep: true, immediate: true }
);
</script>